/**
 * ...
 * @author Yog
 */

package cookinmaddy.client;

class Ajax 
{
    // change the HTML content of a DIV based on its ID
    public static function setContent(id, content) 
	{
        var d = js.Lib.document.getElementById(id);
        if( d == null )
            js.Lib.alert("Unknown element : "+id);
        d.innerHTML = content;
    }
	
	public static function getContentAsync(contentProvider, mycallback) 
	{
		var r = new haxe.Http(contentProvider);
		r.onError = js.Lib.alert;
		r.onData = function(r) { mycallback(r); }
		r.request(false);
	}	
}